#!/usr/bin/python3.9
# -*- coding: utf-8 -*-
# @Time    : 2021/8/28 14:37
# @Author  : YHSimon
import xlwt

# 1. 创建Workbook对象
"""
workbook = xlwt.Workbook(encoding="utf-8")
worksheet = workbook.add_sheet('sheet1')
# 写入数据，第一行参数“行”，第二个参数“列”，第三个参数为内容
worksheet.write(0, 0, 'hello')
# 写入硬盘，保存数据
workbook.save('stu.xls')
"""

# 九九乘法表
workbook = xlwt.Workbook(encoding="utf-8")
worksheet = workbook.add_sheet('sheet1')
for i in range(0, 9):
    for j in range(0, i+1):
        worksheet.write(i, j, str(i + 1) + '*' + str(j + 1) + '= ' + str((i + 1) * (j + 1)))
workbook.save('九九乘法表.xls')
